package com.example.teamilkmall.service.Impl;

import com.example.teamilkmall.controller.exception.ErrorsEnum;
import com.example.teamilkmall.controller.exception.LoginException;
import com.example.teamilkmall.entity.Account;
import com.example.teamilkmall.mapper.AccountMapper;
import com.example.teamilkmall.service.AccountService;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author czl
 * @Date 2025-01-07
 */
@Service
public class AccountServiceImpl implements AccountService {
    private final AccountMapper accountMapper;

    public AccountServiceImpl(AccountMapper accountMapper) {
        this.accountMapper =accountMapper;
    }

    @Override
    public PageInfo<Account> listAccount(Integer pageSize, Integer pageNum, String name) {
        List<Account> list =accountMapper.listAccount(pageSize,pageNum,name);
        PageInfo<Account> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<Account> listAccountAll() {
        return accountMapper.listAccountAll();
    }

    @Override
    public void updateAccount(Account account) {
        accountMapper.updateAccount(account);
    }

    @Override
    public void deloneAccount(Integer id) {
        accountMapper.deloneAccount(id);
    }

    @Override
    public void addAccount(Account account) {
        accountMapper.addAccount(account);
    }


}
